Create a 301 redirect for all http requests that are going to the old domain

  • Example 1 - Redirect from olddomain.com to www.newdomain.com:
 RewriteEngine On
 RewriteCond %{HTTP_HOST} !newdomain.com$ [NC]
 RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]

This is useful when you use www.newdomain.com as your new domain name (see also this article about redirecting www and non-www domains). If not - use the code of example 2.

  • Example 2 - Redirect from olddomain.com to newdomain.com:
 RewriteEngine On
 RewriteBase /
 RewriteCond %{HTTP_HOST} !newdomain.com$ [NC]
 RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I add a trailing slash to requested URLs

Description of the problem: Some search engines remove the trailing slash from urls that look...

Upload max file size

Summary Locate the php.ini file in the folder your upload script resides in. If none...

Assigning an Add-on or Parked domain

In order to Addon or Park domains please perform the following steps: Login to your Gesatech...